import { Schema as S } from "@triplit/client";

export const threadMcpServersSchema = {
  schema: S.Schema({
    id: S.Id({ format: "nanoid" }),
    threadId: S.String(),
    mcpServerId: S.String(),
    enabled: S.Optional(S.Boolean({ default: true })), // 该线程是否启用此MCP服务器
    order: S.Optional(S.Number({ default: 0 })), // 服务器在该线程中的优先级顺序
    createdAt: S.Date({ default: S.Default.now() }),
    updatedAt: S.Date({ default: S.Default.now() }),
  }),
  relationships: {
    thread: S.RelationById("threads", "$threadId"),
    mcpServer: S.RelationById("mcpServers", "$mcpServerId"),
  },
};
